!*********************************************************************************
! This module contains the parameter declarations and their values
!*********************************************************************************
MODULE mod_parameters


USE mod_types
USE mod_param_initial

IMPLICIT NONE



!***************************
!(1) Estimation parameters 
!***************************
INTEGER, PARAMETER::  CAP_N = 1430  !# of individuals
INTEGER, PARAMETER::  totsample =  1430
INTEGER, PARAMETER::  max_t = 11    !max # of tenure periods 
REAL(dp), PARAMETER:: bw = 1.00_dp  !smoothing parameter (before: 0.05, 0.005)



!***************************
!(2) Model parameters
!***************************
REAL(dp):: delta, a_beta, b_beta
!outcome probabilities
REAL(dp):: alpha_1, beta_1, alpha_2, beta_2, alpha_3, beta_3, &
           alpha_11, beta_11, alpha_21, beta_21, alpha_31, beta_31, &
		   alpha_12, beta_12, alpha_22, beta_22, alpha_32, beta_32, &
		   alpha_13, beta_13, alpha_23, beta_23, alpha_33, beta_33, &
		   alpha_14, beta_14, alpha_24, beta_24, alpha_34, beta_34
! separation rates
REAL(dp):: xi_1, xi_2, xi_3, prom2, xi_11, xi_12, xi_14 , xi_24, xi_32, xi_33, xi_21, xi_22, &
           xi_23, xi_34, xi_15, xi_25, xi_26, xi_35
!alpha_4, beta_4, alpha_5, beta_5
!outcome realizations
REAL(dp):: PBAR, tau, output_edu, output_year, &
           basel01, basel11,  basel21,  basel31, &
		   basel02, basel12,  basel22,  basel32, &
		   basel00, basel10,  basel20,  basel30, &
		   base01, base11,  base21,  base31, &
		   base02, base12,  base22,  base32, &
		   base00, base10,  base20,  base30, &
		   c01, c21, c31, c02, c12, c32, c03, c13, c23, c22, c33, phk,	phk2, phk3 

!classification error in the performance rating
REAL(dp):: B_11, B_12, B_13, B_21, B_22, B_23
REAL(dp):: gamma10, gamma11, gamma12, gamma13, &
           gamma20, gamma21, gamma22, gamma23, &
		   gamma30, gamma31, gamma32, gamma33, &
		   gammapast11_0, gammapast11_1, gammapast11_2, &
		   gammapast21_0, gammapast21_1, gammapast21_2, &
		   gammapast22_0, gammapast22_1, gammapast22_2, &
		   gammapast32_0, gammapast32_1, gammapast32_2, &
		   gammapast33_0, gammapast33_1, gammapast33_2, &
		   gammapast11_3, gammapast22_3, gammapast33_3, &
		   gammapast21_3, gammapast32_3, gammafut12, gammafut23
!normalizing constant for the parameters
REAL(dp), PARAMETER:: C = 0.01_dp



REAL(dp):: p_1, p_2, gammap_01, gammap_11, gammap_21, gammap_31,&
           gammap_02, gammap_12, gammap_22, gammap_32, &
		   gammap_03, gammap_13, gammap_23, gammap_33, gammap_41, gammap_51, &
           gammap_42, gammap_52, gammap_43, gammap_53, p_3,  gammap_04, gammap_14, gammap_24
REAL(dp):: p_70, p_71, p_72, p_73, p_74, p_75, p_76, p_77, p_78, p_79



REAL(dp):: s_0, s_1, s_2, s_3, a_prime, a_low, sigma1_u, sigma12_u, sigma13_u, sigma14_u, sigma2_u, sigma3_u, sigma32_u, sigma33_u, sigma34_u, sigma_eps, prcomp, &
           sigma_vu, price, price_1, pp_high, s1_0, s1_1, s1_2, s1_3, s1_4, sigma22_u, sigma23_u, sigma24_u, &
		   pp1_high, p1_low(3), s_4, s_5, s1_5, s_6, p1_high(3), s_02, s_03, y_high,&
		   omega_0, omega_11, omega_12, omega_13, omega_21, omega_22, omega_23, &
		   omega_3, lambda_11, lambda_12, lambda_13, &
		   s_002, s_0022, s_0023, s_0024, s_003, s_0032, s_0033, s_0034, omega_4, &
		   s_12,  s_13,  s_22,  s_23, a1, b1, a2, b2, a3, b3, tau2, tau3, &
		   s_52, s_53, s_54, s1_52, s1_53, s1_54, d, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, &
		   d16, d17, d1_1, d1_2, d1_3, cpen, d18, d19, d20, d21, d22, d23, d24, d25, d26, d27, d28, d52, d29, d30, d31, d32, plus, &
		   d5j2, d5j3, d53, d533, d523, wd,wd3, wd2, tencoef, tencoef1, tencoef2, wd52, d5t2, d5t3, d5t4, wpen, wvar, v74, v75, v76, &
		   v77, v78, v79, wpen1, por, prop, tencoef3, tencoef31, d5j22, d5j23, d5j24, tencoef22

REAL(dp):: w_70, w_71, w_72, w_73, w_74, w_75, w_76, w_77, w_78, w_79, w3_74, w3_75, w3_76, w3_77, w3_78, w3_79, &           
		   w2_74, w2_75, w2_76, w2_77, w2_78, w2_79


REAL(dp):: s1_55, d55, s5_1, s5_2, s5_3, s56_1, s56_2, s56_3, s3_1, s3_2, s3_3


!*****************************************************************************************************************************************
!(3) Subroutine to assign values to the parameters
! i. transform 'x_vector', the parameter vectors used by the amoeba subroutine, into the parameters used in the log-likelihood function
! ii. some parameters are given value here  
!*****************************************************************************************************************************************
CONTAINS


SUBROUTINE parameter_generation(x_vector)

USE mod_param_initial

IMPLICIT NONE

!REMEMBER: from mod_param_initial, num_param is the # of parameters to be estimated and it is made available through the use statement
INTEGER:: j1, ii
REAL(dp), DIMENSION(num_param), INTENT(IN):: x_vector
REAL(dp), PARAMETER:: tiny1=1.0d-20, tinyvar=1.0d-25, tiny20 = 1.0d-20, maxvalue = 180.00_dp,&
                      coefb= 100.00_dp, coefa= 100.00_dp, tiny2=1.0d-10, tinyp  = 1.0d-5,  tinyp1 = 1.0d-5, & 
					  maxsigma = 100000000.00_dp, maxexp2 = 25.00_dp, maxs0 = 14000.00_dp, &
					  maxs1 = 14000.00_dp, maxs2 = 14000.00_dp, maxs3 = 14000.00_dp, &
					  maxs4 = 14000.00_dp, mins0 = -14000.00_dp
INTEGER:: parcount 


!----------------------------------
!a. Update the parameter vector
!----------------------------------
DO j1 = 1, num_param
  p_vector(pos(j1))= x_vector(j1)
END DO		




!------------------
!b. Assign values
!------------------

 alpha_1  = DEXP(p_vector(1))/(1.0_dp+ DEXP(p_vector(1)))

 IF(alpha_1 >  tiny1 .and. alpha_1 <1.0_dp - tiny1) THEN
  alpha_1 = alpha_1

 ELSE IF(alpha_1 <= tiny1)THEN
  alpha_1 = tiny1

 ELSE IF(alpha_1 >= 1.0_dp - tiny1)THEN
  alpha_1 = 1.0_dp - tiny1

 END IF


beta_1  = DEXP(p_vector(60))/(1.0_dp+ DEXP(p_vector(60)))

 IF(beta_1 >  tiny1 .and. beta_1 <1.0_dp - tiny1) THEN
  beta_1 = beta_1

 ELSE IF(beta_1 <= tiny1)THEN
  beta_1 = tiny1

 ELSE IF(beta_1 >= 1.0_dp - tiny1)THEN
  beta_1 = 1.0_dp - tiny1

 END IF



 alpha_2  = DEXP(p_vector(2))/(1.0_dp+ DEXP(p_vector(2)))

 IF(alpha_2 >  tiny1 .and. alpha_2 <1.0_dp - tiny1) THEN
  alpha_2 = alpha_2

 ELSE IF(alpha_2 <= tiny1)THEN
  alpha_2 = tiny1

 ELSE IF(alpha_2 >= 1.0_dp - tiny1)THEN
  alpha_2 = 1.0_dp - tiny1

 END IF


beta_2  = DEXP(p_vector(61))/(1.0_dp+ DEXP(p_vector(61)))

 IF(beta_2 >  tiny1 .and. beta_2 <1.0_dp - tiny1) THEN
  beta_2 = beta_2

 ELSE IF(beta_2 <= tiny1)THEN
  beta_2 = tiny1

 ELSE IF(beta_2 >= 1.0_dp - tiny1)THEN
  beta_2 = 1.0_dp - tiny1

 END IF


 alpha_3  = DEXP(p_vector(3))/(1.0_dp+ DEXP(p_vector(3)))

 IF(alpha_3 >  tiny1 .and. alpha_3 < 1.0_dp - tiny1) THEN
  alpha_3 = alpha_3

 ELSE IF(alpha_3 <= tiny1)THEN
  alpha_3 = tiny1

 ELSE IF(alpha_3 >= 1.0_dp - tiny1)THEN
  alpha_3 = 1.0_dp - tiny1

 END IF

beta_3  = DEXP(p_vector(62))/(1.0_dp+ DEXP(p_vector(62)))

 IF(beta_3 >  tiny1 .and. beta_3 <1.0_dp - tiny1) THEN
  beta_3 = beta_3

 ELSE IF(beta_3 <= tiny1)THEN
  beta_3 = tiny1

 ELSE IF(beta_3 >= 1.0_dp - tiny1)THEN
  beta_3 = 1.0_dp - tiny1

 END IF


PBAR = 0.0_dp


d9 =  DEXP(p_vector(28))
d10 = DEXP(p_vector(29))


 xi_1       = DEXP(p_vector(4))/(1.0_dp+DEXP(p_vector(4)))

 IF(xi_1 >  tiny1 .and. xi_1 < 1.0_dp - tiny1) THEN
  xi_1 = xi_1

 ELSE IF(xi_1 <= tiny1)THEN
  xi_1 = tiny1

 ELSE IF(xi_1 >= 1.0_dp - tiny1)THEN
  xi_1 = 1.0_dp - tiny1

 END IF


  xi_2       = DEXP(p_vector(5))/(1.0_dp+DEXP(p_vector(5)))

 IF(xi_2 >  tiny1 .and. xi_2 < 1.0_dp - tiny1) THEN
  xi_2 = xi_2

 ELSE IF(xi_2 <= tiny1)THEN
  xi_2 = tiny1

 ELSE IF(xi_2 >= 1.0_dp - tiny1)THEN
  xi_2 = 1.0_dp - tiny1

 END IF


 xi_3     = DEXP(p_vector(6))/(1.0_dp+DEXP(p_vector(6)))

IF(xi_3 >  tiny1 .and. xi_3 < 1.0_dp - tiny1) THEN
  xi_3 = xi_3

 ELSE IF(xi_3 <= tiny1)THEN
  xi_3 = tiny1

 ELSE IF(xi_3 >= 1.0_dp - tiny1)THEN
  xi_3 = 1.0_dp - tiny1

 END IF



gammapast11_0 = p_vector(7) 

gammapast11_1 = DEXP(p_vector(47))
!gammapast11_1 = -gammapast11_0



 p_1       = DEXP(p_vector(8))/(1.0_dp+ DEXP(p_vector(8)))

 IF(p_1 >  tinyp .and. p_1 < 1.0_dp - tinyp) THEN
  p_1 = p_1

 ELSE IF(p_1 <= tinyp)THEN
  p_1 = tinyp

 ELSE IF(p_1 >= 1.0_dp - tinyp)THEN
  p_1 = 1.0_dp  - tinyp

 END IF



gammap_01 = p_vector(9)
gammap_02 = p_vector(10)


p_3       = DEXP(p_vector(38))/(1.0_dp+ DEXP(p_vector(38)))

 IF(p_3 >  tinyp .and. p_3 < 1.0_dp - tinyp) THEN
  p_3 = p_3

 ELSE IF(p_3 <= tinyp)THEN
  p_3 = tinyp

 ELSE IF(p_3 >= 1.0_dp - tinyp)THEN
  p_3 = 1.0_dp  - tinyp

 END IF


gammap_03 = p_vector(11)
gammap_04 = p_vector(27)



s_1 = p_vector(12) 
s_2 = p_vector(13)  


sigma1_u   = DEXP(p_vector(14))

IF (sigma1_u >= tinyvar .and. sigma1_u <= maxsigma) THEN
 sigma1_u   = sigma1_u

ELSE IF (sigma1_u < tinyvar) THEN
 sigma1_u = tinyvar

ELSE IF (sigma1_u > maxsigma) THEN
 sigma1_u = maxsigma
END IF


 s1_5  = p_vector(15)


s_3    = p_vector(16)


s_002 = p_vector(17)
s_003 = p_vector(18)



sigma2_u   = DEXP(p_vector(19))

IF ( sigma2_u  >=  tinyvar  .and. sigma2_u  <= maxsigma ) THEN
 sigma2_u   =  sigma2_u

ELSE IF (sigma2_u < tinyvar) THEN
 sigma2_u  = tinyvar

ELSE IF (sigma2_u  > maxsigma) THEN
 sigma2_u  = maxsigma
END IF



sigma3_u   = DEXP(p_vector(20))

IF ( sigma3_u  >=  tinyvar  .and. sigma3_u  <= maxsigma ) THEN
 sigma3_u   =  sigma3_u

ELSE IF (sigma3_u < tinyvar) THEN
 sigma3_u  = tinyvar

ELSE IF ( sigma3_u  > maxsigma) THEN
 sigma3_u  = maxsigma

END IF


sigma32_u = DEXP(p_vector(30))

IF ( sigma32_u  >=  tinyvar  .and. sigma32_u  <= maxsigma ) THEN
 sigma32_u   =  sigma32_u 

ELSE IF (sigma32_u < tinyvar) THEN
 sigma32_u  = tinyvar

ELSE IF (sigma32_u  > maxsigma) THEN
 sigma32_u  = maxsigma

END IF


sigma33_u = DEXP(p_vector(31))

IF ( sigma33_u  >=  tinyvar  .and. sigma33_u  <= maxsigma ) THEN
 sigma33_u   =  sigma33_u 

ELSE IF (sigma33_u < tinyvar) THEN
 sigma33_u  = tinyvar

ELSE IF (sigma33_u  > maxsigma) THEN
 sigma33_u  = maxsigma
END IF


sigma34_u = DEXP(p_vector(32))


IF ( sigma34_u  >=  tinyvar  .and. sigma34_u  <= maxsigma ) THEN
 sigma34_u   =  sigma34_u 

ELSE IF (sigma34_u < tinyvar ) THEN
 sigma34_u  =  tinyvar

ELSE IF (sigma34_u  > maxsigma) THEN
 sigma34_u  = maxsigma

END IF


w_74 = p_vector(21)
w_75 = p_vector(22)
w_76 = p_vector(23)
w_77 = p_vector(24)
w_78 = p_vector(25)
w_79 = p_vector(26)


d5 = DEXP(p_vector(33))


 phk2  = DEXP(p_vector(34))/(1.0_dp+DEXP(p_vector(34)))

 IF(phk2 >  tiny1 .and. phk2 < 1.0_dp - tiny1) THEN
  phk2 = phk2

 ELSE IF(phk2 <= tiny1)THEN
  phk2 = tiny1

 ELSE IF(phk2 >= 1.0_dp - tiny1)THEN
  phk2 = 1.0_dp - tiny1 - phk

 END IF


 d12 = DEXP(p_vector(35))


xi_32     = DEXP(p_vector(36))/(1.0_dp+DEXP(p_vector(36)))

IF(xi_32 >  tiny1 .and. xi_32 < 1.0_dp - tiny1) THEN
  xi_32 = xi_32

 ELSE IF(xi_32 <= tiny1)THEN
  xi_32 = tiny1

 ELSE IF(xi_32 >= 1.0_dp - tiny1)THEN
  xi_32 = 1.0_dp - tiny1

 END IF


 xi_14     = DEXP(p_vector(37))/(1.0_dp+DEXP(p_vector(37)))

IF(xi_14 >  tiny1 .and. xi_14 < 1.0_dp - tiny1) THEN
  xi_14 = xi_14

 ELSE IF(xi_14 <= tiny1)THEN
  xi_14 = tiny1

 ELSE IF(xi_14 >= 1.0_dp - tiny1)THEN
  xi_14 = 1.0_dp - tiny1

 END IF


  xi_34     = DEXP(p_vector(39))/(1.0_dp+DEXP(p_vector(39)))

IF(xi_34 >  tiny1 .and. xi_34 < 1.0_dp - tiny1) THEN
  xi_34 = xi_34

 ELSE IF(xi_34 <= tiny1)THEN
  xi_34 = tiny1

 ELSE IF(xi_34 >= 1.0_dp - tiny1)THEN
  xi_34 = 1.0_dp - tiny1

 END IF


 
d   = DEXP(p_vector(40))

IF(d >  tiny1 ) THEN
  d = d

 ELSE IF(d <= tiny1)THEN
  d = tiny1

END IF


d16   = DEXP(p_vector(41))


IF(d16 >  tiny1 ) THEN
  d16 = d16

 ELSE IF(d16 <= tiny1)THEN
  d16 = tiny1

END IF



xi_21     = DEXP(p_vector(42))/(1.0_dp+DEXP(p_vector(42)))

 IF(xi_21 >  tiny1 .and. xi_21 < 1.0_dp - tiny1) THEN
  xi_21 = xi_21

 ELSE IF(xi_21 <= tiny1)THEN
  xi_21 = tiny1

 ELSE IF(xi_21 >= 1.0_dp - tiny1)THEN
  xi_21 = 1.0_dp - tiny1

 END IF

d1_1 = p_vector(43)


d1_2 = p_vector(44)
d1_3 = p_vector(45)


cpen     = DEXP(p_vector(46))/(1.0_dp+DEXP(p_vector(46)))


IF(cpen >  tiny1 .and. cpen < 1.0_dp - tiny1) THEN
  cpen = cpen

 ELSE IF(cpen <= tiny1)THEN
  cpen = tiny1

 ELSE IF(cpen >= 1.0_dp - tiny1)THEN
  cpen = 1.0_dp - tiny1

 END IF



  xi_25       = DEXP(p_vector(48))/(1.0_dp+DEXP(p_vector(48)))

 IF(xi_25 >  tiny1 .and. xi_25 < 1.0_dp - tiny1) THEN
  xi_25 = xi_25

 ELSE IF(xi_25 <= tiny1)THEN
  xi_25 = tiny1

 ELSE IF(xi_25 >= 1.0_dp - tiny1)THEN
  xi_25 = 1.0_dp - tiny1

 END IF

gammapast33_0 = p_vector(49)

d2 = DEXP(p_vector(50))

IF(d2 >  tiny1 ) THEN
  d2 = d2

 ELSE IF(d2 <= tiny1)THEN
  d2 = tiny1

END IF


d18 = DEXP(p_vector(51))


IF(d18 >  tiny1 ) THEN
  d18 = d18

 ELSE IF(d18 <= tiny1)THEN
  d18 = tiny1

END IF


d19 = DEXP(p_vector(52))


IF(d19 >  tiny1 ) THEN
  d19 = d19

 ELSE IF(d19 <= tiny1)THEN
  d19 = tiny1

END IF



d20 = DEXP(p_vector(53))

IF(d20 >  10.0_dp) THEN
  d20 = d20

 ELSE IF(d20 <= 10.0_dp)THEN
  d20 = 10.0_dp

END IF


d21 = DEXP(p_vector(54))


IF(d21 >  5.0_dp) THEN
  d21 = d21

 ELSE IF(d21 <= 5.0_dp)THEN
  d21 = 5.0_dp

END IF


xi_33  = DEXP(p_vector(55))/(1.0_dp+DEXP(p_vector(55)))

 IF(xi_33 >=  0.00005_dp .and. xi_33 <= 1.0_dp - tiny1) THEN
  xi_33 = xi_33

 ELSE IF(xi_33 < 0.00005_dp)THEN
  xi_33 = 0.00005_dp

 ELSE IF(xi_33 > 1.0_dp - tiny1)THEN
  xi_33 = 1.0_dp - tiny1

 END IF


d22 = DEXP(p_vector(56))


IF(d22 >  tiny1 ) THEN
  d22 = d22

 ELSE IF(d22 <= tiny1)THEN
  d22 = tiny1

END IF


d23 = DEXP(p_vector(57))

IF(d23 >  tiny1 ) THEN
  d23 = d23

 ELSE IF(d23 <= tiny1)THEN
  d23 = tiny1

END IF

d24 = DEXP(p_vector(58))

IF(d24 >  tiny1 ) THEN
  d24 = d24

 ELSE IF(d24 <= tiny1)THEN
  d24 = tiny1

END IF


d25 = DEXP(p_vector(59))


IF(d25 >  5.0_dp) THEN
  d25 = d25

 ELSE IF(d25 <= 5.0_dp)THEN
  d25 = 5.0_dp

END IF


gammapast33_1 = DEXP(p_vector(63))

IF(gammapast33_1 >  tiny1 ) THEN
  gammapast33_1 = gammapast33_1

 ELSE IF(gammapast33_1 <= tiny1)THEN
  gammapast33_1 = tiny1

END IF


d26 = DEXP(p_vector(64))

IF(d26 >  5.0_dp) THEN
  d26 = d26

 ELSE IF(d26 <= 5.0_dp)THEN
  d26 = 5.0_dp

END IF


d27 = DEXP(p_vector(65))

IF(d27 >  3.0_dp ) THEN
  d27 = d27

 ELSE IF(d27 <= 3.0_dp )THEN
  d27 = 3.0_dp 

END IF

d28 = DEXP(p_vector(66))

IF(d28 >  tiny1 ) THEN
  d28 = d28

 ELSE IF(d28 <= tiny1)THEN
  d28 = tiny1

END IF

d52 = p_vector(67)

d29 = DEXP(p_vector(68))

IF(d29 >  1.5_dp ) THEN
  d29 = d29

 ELSE IF(d29 <= 1.5_dp)THEN
  d29 = 1.5_dp

END IF


d30 = DEXP(p_vector(69))

IF(d30 >  1.5_dp ) THEN
  d30 = d30

 ELSE IF(d30 <= 1.5_dp)THEN
  d30 = 1.5_dp

END IF

d31 = DEXP(p_vector(70))


IF(d31 >  1.5_dp ) THEN
  d31 = d31

 ELSE IF(d31 <= 1.5_dp)THEN
  d31 = 1.5_dp

END IF

delta  = DEXP(p_vector(71))/(1.0_dp+DEXP(p_vector(71)))

 IF(delta >=  0.5_dp .and. delta <= 1.0_dp - tiny1) THEN
  delta = delta

 ELSE IF(delta < 0.5_dp)THEN
  delta =  0.5_dp

 ELSE IF(delta > 1.0_dp - tiny1)THEN
  delta = 1.0_dp - tiny1

 END IF


 d32 = DEXP(p_vector(72))


IF(d32 >=  1.5_dp ) THEN
  d32 = d32

 ELSE IF(d32 < 1.5_dp)THEN
  d32 = 1.5_dp

END IF


 plus  = DEXP(p_vector(73))/(1.0_dp+DEXP(p_vector(73)))

 IF(plus >=  0.00005_dp .and. plus <= 1.0_dp - tiny1) THEN
  plus = plus

 ELSE IF(plus < 0.00005_dp)THEN
  plus = 0.00005_dp

 ELSE IF(plus > 1.0_dp - tiny1)THEN
  plus = 1.0_dp - tiny1

 END IF


d5j2 = p_vector(74)

d5j3 = p_vector(75)

d53  = p_vector(76)

d533  = p_vector(77)

d523  = DEXP(p_vector(78))


wd = p_vector(79)

wd3 = DEXP(p_vector(80))

wd2 = DEXP(p_vector(81))

tencoef= DEXP(p_vector(82))

tencoef1= DEXP(p_vector(83))

IF(tencoef1 >=  0.00005_dp .and. tencoef1 <= 1.0_dp - tiny1) THEN
  tencoef1 = tencoef1

 ELSE IF(tencoef1 < 0.00005_dp)THEN
  tencoef1 = 0.00005_dp

 ELSE IF(tencoef1 > 1.0_dp - tiny1)THEN
  tencoef1 = 1.0_dp - tiny1

 END IF

tencoef2= DEXP(p_vector(84))

sigma22_u = DEXP(p_vector(85))

sigma23_u = DEXP(p_vector(86))

sigma24_u = DEXP(p_vector(87))

wd52 = DEXP(p_vector(88))

s_0032 = p_vector(89)

s_0033 = p_vector(90)

s_0034 = p_vector(91)

s_0022 = p_vector(92)

s_0023 = p_vector(93)

s_0024 = p_vector(94)

s1_52 = p_vector(95)

s1_53 = p_vector(96)

s1_54 = p_vector(97)


d5t2 = p_vector(98)
 
d5t3 = p_vector(99)

d5t4 = p_vector(100)


sigma12_u = DEXP(p_vector(101))

sigma13_u = DEXP(p_vector(102))

sigma14_u = DEXP(p_vector(103))

wpen      = p_vector(104)

wvar      = DEXP(p_vector(105))


v74 = DEXP(p_vector(106))

v75 = DEXP(p_vector(107))

v76 = DEXP(p_vector(108))

v77 = DEXP(p_vector(109))

v78 = DEXP(p_vector(110))

v79 = DEXP(p_vector(111))

wpen1 = p_vector(112)

por  = p_vector(113)

prop  =  p_vector(114) 

tencoef3  = DEXP(p_vector(115)) 

tencoef31  = p_vector(116) 

d5j22 = p_vector(117)

d5j23 = p_vector(118)

d5j24 = p_vector(119)

w2_74 = p_vector(120)

w2_75 = p_vector(121) 

w2_76 = p_vector(122) 

w2_77 = p_vector(123) 

w2_78 = p_vector(124) 

w2_79 = p_vector(125) 

w3_74 = p_vector(126) 

w3_75 =p_vector(127) 

w3_76 =p_vector(128) 

w3_77 =p_vector(129) 

w3_78 =p_vector(130)  

w3_79 =p_vector(131)

s5_1 =p_vector(132)
 
s5_2 =p_vector(133)
 
s1_55 = DEXP(p_vector(134))
 
d55  =p_vector(135)

s5_3 =p_vector(136)

s56_1 =p_vector(137)

s56_2 =p_vector(138)

s56_3 =p_vector(139)

s3_1 =p_vector(140)

s3_2 =p_vector(141)

s3_3 =p_vector(142)

tencoef22 =p_vector(143)


!---------------------------------------------------------------------------------
!c. Parameter constraints to reproduce the results in the main text of the paper
!---------------------------------------------------------------------------------
gammap_12 = gammap_11
gammap_13 = gammap_11
gammap_14 = gammap_11
gammap_22 = 0.0_dp
gammap_23 = 0.0_dp
gammap_24 = 0.0_dp

gammapast22_0 = gammapast11_0
gammapast22_1 = gammapast11_1

lambda_11 = 0.0_dp
lambda_12 = 0.0_dp
lambda_13 = 0.0_dp
omega_11 = 0.0_dp
omega_12 = 0.0_dp
omega_13 = 0.0_dp
omega_21 = 0.0_dp
omega_22 = 0.0_dp
omega_23 = 0.0_dp

tau =  1.0_dp
tau2 = 1.0_dp
tau3 = 1.0_dp
gammap_11 = 0.0_dp
sigma_eps = 0.0_dp
s_4 = 0.0_dp
d4 = 0.0_dp
phk = 0.0_dp
p_2   = phk2
phk3  = 1.0_dp
xi_11 = xi_21

gammapast33_0 = gammapast11_0  
gammapast11_1 = gammapast11_0
gammapast33_1 = gammapast33_0

v74 = 1.0_dp
v75 = 1.0_dp
v76 = 1.0_dp
v77 = 1.0_dp
v78 = 1.0_dp
v79 = 1.0_dp

wd2  = 0.0_dp
wd3  = 0.0_dp
wd52 = 0.0_dp
d53  = 0.0_dp
d533 = 0.0_dp

w_70 = 0.0_dp
w_71 = w_70 
w_72 = w_70 
w_73 = w_70 
w_74 = -DABS(w_74) 
w_75 = -DABS(w_75) 
w_76 = -DABS(w_76) 
w_77 = -DABS(w_77) 
w_78 = -DABS(w_78) 
w_79 = -DABS(w_79) 

w_74  = w_75
w2_74 = w2_75
w3_74 = w3_75
wvar = 1.0_dp
xi_32 = 0.0_dp
s5_1  = 0.0_dp
s5_2  = 0.0_dp
s5_3  = 0.0_dp
s56_1 = 0.0_dp
s56_2 = 0.0_dp
s56_3 = 0.0_dp
d55   = 0.0_dp
s1_55 = 0.0_dp
tencoef = 0.0_dp
tencoef2  = 0.0_dp
tencoef22 = 0.0_dp
tencoef3  = 0.0_dp
tencoef31 = 0.0_dp
wd = 0.0_dp
prop = 0.0_dp
wpen1 = 0.0_dp
por   = 0.0_dp
wpen  = 0.0_dp
d25 = 0.0_dp
d26 = 0.0_dp
d18 = 0.0_dp
d19 = 0.0_dp
w2_74 = w_74
w2_75 = w_75
w2_76 = w_76
w2_77 = w_77
w2_78 = w_78
w2_79 = w_79
w3_74 = w_74
w3_75 = w_75
w3_76 = w_76
w3_77 = w_77
w3_78 = w_78
w3_79 = w_79
d5j2 = 0.0_dp
d5j3 = 0.0_dp
d5j22 = 0.0_dp
d5j23 = 0.0_dp
d5j24 = 0.0_dp

sigma32_u = sigma3_u
sigma33_u = sigma3_u
sigma34_u = sigma3_u

d1_3 = 0.0_dp
d19 = 0.0_dp
d9 = d20
d29 = 0.0_dp
d2 = 0.0_dp
d52 = 0.0_dp
d523 = 0.0_dp
d22 = d30



END SUBROUTINE parameter_generation



END MODULE mod_parameters
